<?php

namespace app\admin\controller\wms;

use app\common\controller\Backend;

/**
 * 兼容之前系统sku
 */
class Specs extends Backend
{
    /**
     * Specs模型对象
     * @var object
     * @phpstan-var \app\admin\model\wms\Specs
     */
    protected object $model;

    protected array|string $preExcludeFields = ['id'];

    protected string|array $quickSearchField = ['id'];

    public function initialize(): void
    {
        parent::initialize();
        $this->model = new \app\admin\model\wms\Specs;
    }


    // 通用规格分组表
    public function get()
    {
        $data = [];
       $list = $this->model->select();
       foreach ($list as $v) {
           $data[$v->spec_type][] = $v->toArray();
       }

        $res = [
            'spec_type' => $data[1],
            'spec_condition' => $data[2],
            'spec_company' => $data[3]
        ];

       $this->success('', $res);
    }


    /**
     * 若需重写查看、编辑、删除等方法，请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写
     */
}
